package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string `gorm:"type:varchar(30)" json:"username"`
	Password string `gorm:"type:varchar(255)" json:"password"`
}
type Rest struct {
	gorm.Model
	Title           string `gorm:"type:varchar(30)" json:"title"`
	Content         string `gorm:"type:varchar(30)" json:"content"`
	Img             string `gorm:"type:varchar(255)" json:"img"`
	UserID          int    `gorm:"type:int" json:"user_id"`
	User            User   `gorm:"foreignKey:UserID" json:"user"`
	CollectionCount int    `gorm:"type:int" json:"collection_count"`
}

type Collection struct {
	gorm.Model
	UserID int  `gorm:"type:int" json:"user_id"`
	User   User `gorm:"foreignKey:UserID" json:"user"`
	RestID int  `gorm:"type:int" json:"rest_id"`
	Rest   Rest `gorm:"foreignKey:RestID" json:"rest"`
}
